#!/bin/python3

import os
import sys
import glob

folder = sys.argv[1] 

for filename in glob.glob(folder):
    print(folder)
    if os.path.isfile(filename):
        with open(filename, 'r+') as f:
            lines = f.readlines()
            f.seek(0)
            for line in lines[:-2]:
                f.write(line)
            f.truncate()
